using IcsSEMCtrl.Util;
using System;
namespace Lifter.Global.Device
{
	public class UserType
	{
		public const int _OPERATOR = 0;
		public const int _MAINTANENCE = 1;
		public const int _ADMINISTRATOR = 2;
		private int _value;
		private static int _size;
		private static UserType[] _array;
		public static string[] displayStrings;
		public static UserType[] displayValues;
		public static UserType OPERATOR;
		public static UserType MAINTANENCE;
		public static UserType ADMINISTRATOR;
		public static UserType IT_ENUM_MAX;
		static UserType()
		{
			UserType._size = 3;
			UserType._array = new UserType[UserType._size];
			UserType.displayStrings = new string[UserType._size];
			UserType.displayValues = new UserType[UserType._size];
			UserType.OPERATOR = new UserType(0);
			UserType.MAINTANENCE = new UserType(1);
			UserType.ADMINISTRATOR = new UserType(2);
			UserType.IT_ENUM_MAX = new UserType(2147483647);
			UserType.displayStrings[0] = "OPERATOR";
			UserType.displayStrings[1] = "MAINTANENCE";
			UserType.displayStrings[2] = "ADMINISTRATOR";
			UserType.displayValues[0] = UserType.OPERATOR;
			UserType.displayValues[1] = UserType.MAINTANENCE;
			UserType.displayValues[2] = UserType.ADMINISTRATOR;
		}
		public static string ValueToString(UserType val)
		{
			string result;
			if (val != null)
			{
				switch (val.Value())
				{
				case 0:
					result = UserType.displayStrings[0];
					break;
				case 1:
					result = UserType.displayStrings[1];
					break;
				case 2:
					result = UserType.displayStrings[2];
					break;
				default:
					result = "";
					break;
				}
			}
			else
			{
				result = "";
			}
			return result;
		}
		public static UserType StringToValue(string val)
		{
			UserType result;
			if (Helper.IsNullOrEmpty(val))
			{
				result = UserType.IT_ENUM_MAX;
			}
			else
			{
				for (int i = 0; i < UserType.displayStrings.Length; i++)
				{
					if (val.Equals(UserType.displayStrings[i]))
					{
						result = UserType.displayValues[i];
						return result;
					}
				}
				result = null;
			}
			return result;
		}
		public int Value()
		{
			return this._value;
		}
		public static UserType From_Int(int value)
		{
			UserType result;
			if (value >= 0 && value < UserType._size)
			{
				result = UserType._array[value];
			}
			else
			{
				result = UserType.IT_ENUM_MAX;
			}
			return result;
		}
		protected UserType(int value)
		{
			this._value = value;
			if (value >= 0 && value < UserType._size)
			{
				UserType._array[this._value] = this;
			}
		}
		public bool Equals(UserType otherEnum)
		{
			return otherEnum.Value() == this._value;
		}
		public override string ToString()
		{
			return UserType.displayStrings[this._value];
		}
	}
}
